<!DOCTYPE html>
<html>
  <head>
      <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  </head>
  <body>
    <div id="app">
      <localassembly :count="count" @parent-click="click"></localassembly>

    </div>
    <script>
    
    // 局部组件
    const localassembly =  {
      template: '<div><span>这是第 {{ count }} 次点击</span> <input type="button" value="点击此按钮" @click="clickme" /></div>',
      methods: {
        clickme(){
          this.$emit("parent-click", 1 )
        }
      },
      props: ['count']
    }
    const vm = new Vue({
      el: '#app',
      data() {
        return {
          count:0
        }
      },
      components: {
        localassembly
      },
      methods:{
        click(val){
          this.count+=val
        }
      }
    })
    </script>
  </body>
</html>